/*
 * Metaverse Core
 * Copyright (C) 2010 Vyacheslav Vorobyov, All rights reserved.
 * See LICENSE for full license information.
 */
package org.metaverse.warehouse.com;


/**
 * @author vjache
 *
 */
public abstract class Junction extends ValueConstraint {

	private final ValueConstraint[] _valueConstraints;

	/**
	 * @param aCode
	 */
	public Junction(Code aCode,ValueConstraint...constraints) {
		super(aCode);
		_valueConstraints = constraints;
	}

	/**
	 * @return the valueConstraints
	 */
	public final ValueConstraint[] getValueConstraints() {
		return _valueConstraints;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append('(');
		sb.append(getCode());
		sb.append(':');
		sb.append('[');
		for(int i=0;i<_valueConstraints.length;i++)
		{
			if(i>0)
				sb.append(',');
			sb.append(_valueConstraints[i]);
		}
		sb.append(']');
		sb.append(')');
		return sb.toString();
	}
}
